package com.huawei.hwCloudJs.service.locationapi.a;

import android.content.SharedPreferences.Editor;
import com.huawei.hwCloudJs.b;

public final class a {
    private static a a = null;
    private static final String b = "SharedPreferencesStorage";

    private a() {
    }

    public static synchronized a a() {
        a aVar;
        synchronized (a.class) {
            if (a == null) {
                a = new a();
            }
            aVar = a;
        }
        return aVar;
    }

    public void a(String str, boolean z) {
        if (com.huawei.hwCloudJs.b.a.a() != null) {
            Editor edit = com.huawei.hwCloudJs.b.a.a().getSharedPreferences(b.t, 0).edit();
            edit.putBoolean(str, z);
            edit.commit();
        }
    }

    public boolean a(String str) {
        return com.huawei.hwCloudJs.b.a.a() != null ? com.huawei.hwCloudJs.b.a.a().getSharedPreferences(b.t, 0).getBoolean(str, false) : false;
    }

    public void b() {
        if (com.huawei.hwCloudJs.b.a.a() != null) {
            com.huawei.hwCloudJs.b.a.a().getSharedPreferences(b.t, 0).edit().clear().commit();
        }
    }

    public void b(String str) {
        if (com.huawei.hwCloudJs.b.a.a() != null) {
            Editor edit = com.huawei.hwCloudJs.b.a.a().getSharedPreferences(b.t, 0).edit();
            edit.putString(b.u, str);
            edit.commit();
        }
    }

    public String c() {
        return com.huawei.hwCloudJs.b.a.a() != null ? com.huawei.hwCloudJs.b.a.a().getSharedPreferences(b.t, 0).getString(b.u, "") : "";
    }
}
